<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商场折扣</title>
</head>

<body>
    <script>
        document.write("《JavaScript》单价为59.00" + "<br />");
        document.write("钢笔单价为30.00" + "<br />");
        document.write("眼镜单价为199.00" + "<br />");
        document.write("牛奶单价为68.00" + "<br />");
        var books = prompt("请输入《JavaScript》书的购买数量：");
        if (books == 1) {
            var books1 = books * 59 * 0.9;
        } else if (books == 2) {
            var books1 = books * 59.00 * 0.8;
        } else if (books == 3) {
            var books1 = books * 59.00 * 0.7;
        } else if (books >= 4) {
            var books1 = books * 59.00 * 0.65;
        }
        var pen = prompt("请输入钢笔的购买数量：");
        if (pen == 1) {
            var pen1 = pen * 30 * 0.9;
        } else if (pen == 2) {
            var pen1 = pen * 30 * 0.8;
        } else if (pen == 3) {
            var pen1 = pen * 30 * 0.7;
        } else if (pen >= 4) {
            var pen1 = pen * 30 * 0.65;
        }
        var glasses = prompt("请输入眼镜的购买数量：");
        if (glasses == 1) {
            var glasses1 = glasses * 199 * 0.9;
        } else if (glasses == 2) {
            var glasses1 = glasses * 199 * 0.8;
        } else if (glasses == 3) {
            var glasses1 = glasses * 199 * 0.7;
        } else if (glasses >= 4) {
            var glasses1 = glasses * 199 * 0.65;
        }
        var milk = prompt("请输入牛奶的购买数量：");
        if (milk == 1) {
            var milk1 = milk * 68 * 0.9;
        } else if (milk == 2) {
            var milk1 = milk * 68 * 0.8;
        } else if (milk == 3) {
            var milk1 = milk * 68 * 0.7;
        } else if (milk >= 4) {
            var milk1 = milk * 68 * 0.65;
        }
        var sum = books1 + pen1 + glasses1 + milk1;
        document.write("折后价格总和为：" + sum);
    </script>
</body>

</html>